UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fA4XhgVcduKyI19v/J9mG7K6x/nIiWyRGyWjnhn6Y/8=' 
WHERE 
  key_id = '21f86a9e61e5fa3685ab8b8ac48f54bff5022ce8930d1ca4efdd60c64338ed4c' 
  AND (
    token = 'fA4XhgVcduKyI19v/J9mG7K6x/nIiWyRGyWjnhn6Y/8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037