UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HuHjKXjsWPhWUa4/rY7Z0bjfMT3RnOnRXmYuRXQJlHY=' 
WHERE 
  key_id = '3f4029d6ac7571842ee8c82984f62839721de42faf770763627622aade34cb0e' 
  AND (
    token = 'HuHjKXjsWPhWUa4/rY7Z0bjfMT3RnOnRXmYuRXQJlHY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034