UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ODUfVX20JRu2MBzLtj+wLmO7vUw8y51wcAh2rEn85A8=' 
WHERE 
  key_id = '27044b04579346f85be3721aa96724aefa19f39e6ec48305cc70893c069d80ac' 
  AND (
    token = 'ODUfVX20JRu2MBzLtj+wLmO7vUw8y51wcAh2rEn85A8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029