UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jItrY728MbDS4hFfNTBeplIxeCi58TozYE+k/1vw9vQ=' 
WHERE 
  key_id = '8f0d3305d51e28e5a22c78390d9b67146e44c7cb2bbc5d6fe488eb3ccc5e4e84' 
  AND (
    token = 'jItrY728MbDS4hFfNTBeplIxeCi58TozYE+k/1vw9vQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020