UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A3/8lKMp0xSv3s0yMmz1RkJidvDwh2dI1ejVNcaDWe4=' 
WHERE 
  key_id = '12c9b8ad5bc691ad0d44abff5f76a3472abd2fc69018f900dc1c1cf851bf5384' 
  AND (
    token = 'A3/8lKMp0xSv3s0yMmz1RkJidvDwh2dI1ejVNcaDWe4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040