UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ZlTxAkFAckEoZdM84DFDxubPRhujPHm5CDa0/wa2Aps=' 
WHERE 
  key_id = 'aa09ca06208d595072eb78ac9af0d91533330f378a4236a55a2845b2a672c7bf' 
  AND (
    token = 'ZlTxAkFAckEoZdM84DFDxubPRhujPHm5CDa0/wa2Aps=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052