UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iM2jQ897IIwpd2jPA2VfwIRS9TlWo04gYLPbF2igKMU=' 
WHERE 
  key_id = '06dc4542a2f6f8db1aae9c98f7e623a52b6a8c5ea9003f82a2cb8ccc9f44822c' 
  AND (
    token = 'iM2jQ897IIwpd2jPA2VfwIRS9TlWo04gYLPbF2igKMU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026