UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'u7bXAQpzCs4BpYrCnZyJBCXUoXtunYfMMO7dr9lH++c=' 
WHERE 
  key_id = '64449ebaec807ef80d2e299c228ae59325447602397e0084f50cbf23f0d766e7' 
  AND (
    token = 'u7bXAQpzCs4BpYrCnZyJBCXUoXtunYfMMO7dr9lH++c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050