UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NDZCxza/vBk/RkaxMqeSZTiQtjpif5oKz4sYN/nI42Q=' 
WHERE 
  key_id = '7895847f74161bae11f61d02e50524d16fc329376dae08da3cd5d62f9b47878a' 
  AND (
    token = 'NDZCxza/vBk/RkaxMqeSZTiQtjpif5oKz4sYN/nI42Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021