UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'avKFhOj/+/hF1uv8VdJDumOTkV0ipNh89UedHwZ8wCU=' 
WHERE 
  key_id = '19c79b06ea6234254c2d43c6f178c30034b11622778f2e34c33f677e42dbdeb7' 
  AND (
    token = 'avKFhOj/+/hF1uv8VdJDumOTkV0ipNh89UedHwZ8wCU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026