UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7fuFW4aehkCz35p4UVap+tY/oisl9lsKXuaaQNFHdFQ=' 
WHERE 
  key_id = '240e4ef4a7a6dce499d8098012ba604c1867acc5746e2a2dd1497b7714336273' 
  AND (
    token = '7fuFW4aehkCz35p4UVap+tY/oisl9lsKXuaaQNFHdFQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031