UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7yU8jSFK8Poqzugee+dUBCZVqjo0ARhKtCQSONyeeKc=' 
WHERE 
  key_id = '7f8386899842669b6ec978de6468e10d362ce5958675c512df9f924e7ceddd63' 
  AND (
    token = '7yU8jSFK8Poqzugee+dUBCZVqjo0ARhKtCQSONyeeKc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044