UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OXq8mzgNulFNXtOCiSPt5W18KMo2k8ZCcCRB1+ekCgE=' 
WHERE 
  key_id = '337491ff61f5b1455381de6a6361fd6b20711408fb7fb90fb26d71563cad4b70' 
  AND (
    token = 'OXq8mzgNulFNXtOCiSPt5W18KMo2k8ZCcCRB1+ekCgE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026