UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'v4HwgdG39Qi1/zUl8cJ0hC3y6UBgaNjv3d2VulW6QG8=' 
WHERE 
  key_id = 'a6586ac911be9a4085c61a0faf0e751dcc73e20803a41539a6efae6255354ac8' 
  AND (
    token = 'v4HwgdG39Qi1/zUl8cJ0hC3y6UBgaNjv3d2VulW6QG8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042