UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SCjmjvnF83sGh4NlRDZlC5n+Q944uYpW0Flqm8nk3sw=' 
WHERE 
  key_id = '0ded0a0cc84175c130c439988cb8db8553b49cd401f61a9d3ce00afc167252ac' 
  AND (
    token = 'SCjmjvnF83sGh4NlRDZlC5n+Q944uYpW0Flqm8nk3sw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032