UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'le5EbaQ+blngiYGYYnxensjgwemFltafLr+A9MXm8Tc=' 
WHERE 
  key_id = 'd50f5888bea017ef5fb3dcb9895bd4b35e4ee58842a40b16a5121bd34bc574e7' 
  AND (
    token = 'le5EbaQ+blngiYGYYnxensjgwemFltafLr+A9MXm8Tc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027