UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '0P2iFPAgw20idAI/6aK+u5qu1phYocyzFvpcStRUz6I=' 
WHERE 
  key_id = 'aad3db809ba6051a36888f536cb3b114793b4632e2081fb91255d36755582afd' 
  AND (
    token = '0P2iFPAgw20idAI/6aK+u5qu1phYocyzFvpcStRUz6I=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034