UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'K20Ef0nVqKXjy+PDu3KiEj4U9AQ/uW6d6cteM7sNuvo=' 
WHERE 
  key_id = '966da90a75ebb88c320a0195f542813a2236183c85d1ddb2abd131ab77798756' 
  AND (
    token = 'K20Ef0nVqKXjy+PDu3KiEj4U9AQ/uW6d6cteM7sNuvo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048