UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tGByB6HMwoSZvPSsJI5sEBfLhNT6F+yoEwaJWb4XPGI=' 
WHERE 
  key_id = '3138ebbf3a50434907b57ad7bcc1bb15c1455819eff3f8c9230bc343216aa3a4' 
  AND (
    token = 'tGByB6HMwoSZvPSsJI5sEBfLhNT6F+yoEwaJWb4XPGI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038