UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'redyV0dK2zPjaQmvff2h+qrvJa8FSUlXm5HlVQxNbds=' 
WHERE 
  key_id = '96fb3c7f449601d5acc05d9afad65e05df20ebeaa2fd9609fcfe18a9062004f6' 
  AND (
    token = 'redyV0dK2zPjaQmvff2h+qrvJa8FSUlXm5HlVQxNbds=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017