UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ui0f+TzfdHmH5pN0v4lIvRKg7HH5iW3JIg5c1Dxx5MI=' 
WHERE 
  key_id = 'd1e8acc4a7419672e42cf1623156cfe7b5b1b98e0cb2fc65e440d5ba4849e835' 
  AND (
    token = 'Ui0f+TzfdHmH5pN0v4lIvRKg7HH5iW3JIg5c1Dxx5MI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048