UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OMNpd1sXuzhP2G+WNT6n98CHAUvDD8UMsDYAm0y+5RI=' 
WHERE 
  key_id = 'ed5d35846ef8fe353e2346a17a7119fbcdaf2390d61152683dd786286463ec5b' 
  AND (
    token = 'OMNpd1sXuzhP2G+WNT6n98CHAUvDD8UMsDYAm0y+5RI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024