UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'T8+em95eTCQTIZVPawORvPPzAcjR4CybpqKI9zciEBM=' 
WHERE 
  key_id = 'd85cbbb2e31b249d1946b889ec15bc305c9a20d2fb6164ee9ffcf09f8e1ed7aa' 
  AND (
    token = 'T8+em95eTCQTIZVPawORvPPzAcjR4CybpqKI9zciEBM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047