UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fbWnVXA28+vNmOhuPv/9a0I4xHEVjvujj/nFI9V8blk=' 
WHERE 
  key_id = 'e8af06ea8a83da88d29680c4563d6225447ce19ed0ee0365effbd1d576830493' 
  AND (
    token = 'fbWnVXA28+vNmOhuPv/9a0I4xHEVjvujj/nFI9V8blk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035