UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PQxmUpgLJ+jtffbTpdeWIMawYF21YvbZS/qTVv93UoQ=' 
WHERE 
  key_id = '4371968573ea2d338f800d38966798ce477de4080cd000700df1c63e22b08fe8' 
  AND (
    token = 'PQxmUpgLJ+jtffbTpdeWIMawYF21YvbZS/qTVv93UoQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031