UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e32/ctl9cZpZou2yNhMoKXFuS5bN8XrQkpNnvpl0BOc=' 
WHERE 
  key_id = 'a948e2ed802a735545386af21bf4ec3262247a0a7bbff8140dd846b4c05fe540' 
  AND (
    token = 'e32/ctl9cZpZou2yNhMoKXFuS5bN8XrQkpNnvpl0BOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035