UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CiDuYb45Fgbbh53FYdfXwHvQ56r3MHpZtfitm7sjcMs=' 
WHERE 
  key_id = '0a9677d3fae8481e89af2fa956bc035fc8e9496a7cf032229316ec74cd063b2d' 
  AND (
    token = 'CiDuYb45Fgbbh53FYdfXwHvQ56r3MHpZtfitm7sjcMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040