UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'H19fYli84bhnuVkxM4s+KV2E/Yamq7BHj/hXhMxdTPc=' 
WHERE 
  key_id = '6a3fa8374e069f71619bc491f60da149d400c041b5bf2abe728ba481c0fa7a87' 
  AND (
    token = 'H19fYli84bhnuVkxM4s+KV2E/Yamq7BHj/hXhMxdTPc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051