UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BY1PkBzPO/9zWj2JpP1n3y775FAiqL6VlluYkKgy+cY=' 
WHERE 
  key_id = '67476fea73dfefef8bdd99f909d4e90e06b7d67b6b8bf8acc07810071095a107' 
  AND (
    token = 'BY1PkBzPO/9zWj2JpP1n3y775FAiqL6VlluYkKgy+cY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038