UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '28hPM5oCOMNodyn+Ymxgdj48DdbJlXz1lFpeFeApDfg=' 
WHERE 
  key_id = '9e183844b74092824f828c3051a530dbc344df91c0221cdf6172b4daf3edbfc1' 
  AND (
    token = '28hPM5oCOMNodyn+Ymxgdj48DdbJlXz1lFpeFeApDfg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052