UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'feGc9n/14FG183Jio36kik5P+Y8H0f4Nx2liUMpcecM=' 
WHERE 
  key_id = '1cdd022ec1445676ac704c2c161c99ca45a12a6cdfa3f3710c092e2496c68bb7' 
  AND (
    token = 'feGc9n/14FG183Jio36kik5P+Y8H0f4Nx2liUMpcecM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040