UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IuohNsukao4ixJ786uEnQLOjOdlzmCZURrnC+1UeWLo=' 
WHERE 
  key_id = 'b83af5c41c4954180643aaa477ad9a18d34d2abd5ee44153197fbc635ad5a60f' 
  AND (
    token = 'IuohNsukao4ixJ786uEnQLOjOdlzmCZURrnC+1UeWLo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020