UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IczQj79ymYuV32eRq5vJbRWWO1CITo3C0C8cugpaIBc=' 
WHERE 
  key_id = '3e46b8ab35d87363c9c97021763211267379bbb043ba057d8dbf8cf16047dd7c' 
  AND (
    token = 'IczQj79ymYuV32eRq5vJbRWWO1CITo3C0C8cugpaIBc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026