UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BIh2f/xl369pI4Mbc7ZDCpPMqi48WLkC43m1AVQvLnA=' 
WHERE 
  key_id = '30cef8c089272c2c5d8672b406aed6d877e33804f0dcc35e03e388716cf6cfca' 
  AND (
    token = 'BIh2f/xl369pI4Mbc7ZDCpPMqi48WLkC43m1AVQvLnA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030