UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vtTLTM6BH84e2zW3i8d2FBTXB/bi8lBX1/KvTMuQaOU=' 
WHERE 
  key_id = 'bcfac88b7ef08d6f46033dca256e14839807926bd01758d4ca235e738082f299' 
  AND (
    token = 'vtTLTM6BH84e2zW3i8d2FBTXB/bi8lBX1/KvTMuQaOU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041