UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bWkb3gr0xvalxnNJyMwecSv75VFwJk0XtYINi/x4JxY=' 
WHERE 
  key_id = '326df17908f83f6328e0a5dada0f0d9697eab3527726a0624f8ecd376d839a88' 
  AND (
    token = 'bWkb3gr0xvalxnNJyMwecSv75VFwJk0XtYINi/x4JxY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040