UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FZ/2aidvwmiSyc8cWJy5Wsk0LiTZrGWBqpHPDk3wJ7k=' 
WHERE 
  key_id = 'd72f215ddfe9eccb3975ef15f0864b64801333303443a50c4c1bcbc1b166d494' 
  AND (
    token = 'FZ/2aidvwmiSyc8cWJy5Wsk0LiTZrGWBqpHPDk3wJ7k=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034